<cfcomponent output="false">
	
	<!--- --->
	
	<cffunction name="renderLogin" access="public" output="false" returntype="string">

		<cfset var local = {} />
		
		<cfset local.divToShow = "loggedOut" />
		
		<cfset local.user = application.s.loginService.beginSession() />
		<cfif local.user.recordcount eq 1>
			<cfset local.divToShow = "loggedIn" />
		</cfif>
		
		<cfsavecontent variable="local.result">
			<cfoutput>
				<table>
					<tr>
						<td id="top_bar-right">
							<div id="login-loggedOut" class="loginDiv <cfif local.divToShow eq 'loggedOut'><cfelse>hidden</cfif>">
								<button type="button" onclick="javascript:Login.showCreateForm();">Create Account</button>
								<button type="button" onclick="javascript:Login.showLoginForm();">Login</button>
								<form action="#application.q.form('loginController','facebookLogin')#" method="post">
									<button type="submit">Facebook Login</button>
								</form>
							</div>
							<div id="login-logIn" class="hidden loginDiv">
								<input name="email" value="" placeholder="email" size="14" validate="required,email" /><input name="password" type="password" placeholder="password" size="8" validate="required" onkeyup="javascript:Login.logInByEnter(event);" />
								<button type="button" onclick="javascript:Login.logIn();">Login</button></br>
								<button class="small" type="button" onclick="javascript:Login.showCreateForm();">Create Account</button>
								<form action="#application.q.form('loginController','facebookLogin')#" method="post" style="display:inline;">
									<button class="small"type="submit">Facebook Login</button>
								</form>
							</div>
							<div id="login-loggedIn" class="<cfif local.divToShow neq "loggedIn">hidden</cfif> loginDiv">
								<a class="top_bar-nav nav-myDonations clickable">My Donations <span class="navSubText" id="userDonationPerWeek">$123 per week</span></a>
								<a class="top_bar-nav nav-myFunds clickable">My Funds <span class="navSubText" id="userAvailableBalance">$1,423</span></a>
							</div>
							<div id="login-newUser" class="hidden loginDiv">
								<input name="email" value="" placeholder="email" size="14" validate="required,email,match1" />
								<input name="email2" value="" placeholder="confirm email" size="14" validate="required,email,match1" />
								<input name="password" type="password" value="" placeholder="password" size="8" validate="required,match2" />
								<input name="password2" type="password" value="" placeholder="confirm password" size="8" validate="required,match2" />
								</br>
								<input name="first_name" value="" placeholder="first name" size="8" validate="required" />
								<input name="middle_name" value="" placeholder="middle name" size="8" />
								<input name="last_name" value="" placeholder="last name" size="8" validate="required" />
								<input name="city" value="" placeholder="city" size="8" validate="required" />
								#application.q.select("stateID",application.s.resourceService.getStates())#
							</div>
						</td>
					</tr>
					<tr>
						<td id="top_bar-rightBottom">
							<div id="login-loggedInBottom" class="top_bar-bottomNav <cfif local.divToShow neq "loggedIn">hidden</cfif>">
								Logged in as: <span id="userFullName">#session.user.first_name# #session.user.last_name#</span>&nbsp;&nbsp;&nbsp;<button class="small" onclick="javascript:Login.logOut();">Log Out</button>
							</div>
							<div id="login-newUserBottom" class="hidden top_bar-bottomNav loginDiv">
								<button class="small" onclick="javascript:Login.showLoginForm();">Login</button>
								<button class="small" onclick="javascript:Login.createUser();">Create Account</button>
							</div>
						</td>
					</tr>
				</table>
			</cfoutput>
		</cfsavecontent>
		
		<cfreturn local.result />
		
	</cffunction>
	
	<!--- --->

</cfcomponent>